import Vue from 'vue'
import VueRouter from 'vue-router'
// import HomeView from '../views/HomeView.vue'
import Backend from '@/views/backend/Backend.vue'
import Front from '@/views/front/Front.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/front'
  },
  {
    path: '/front',
    component: Front,
    redirect: '/front/home',
    children: [
      {
        path: 'home',
        component: () => import('@/views/front/page/Home')
      }, {
        path: 'flower',
        redirect: '/undone',
        // component: () => import('@/views/front/page/Flower')
      }, {
        path: 'crops',
        redirect: '/undone',
        // component: () => import('@/views/front/page/Crops')
      }, {
        path: 'edu',
        redirect: '/undone',
        // component: () => import('@/views/front/page/Edu')
      }, {
        path: 'forum',
        redirect: '/undone',
        // component: () => import('@/views/front/page/Forum')
      }, {
        path: 'notes',
        redirect: '/undone',
        // component: () => import('@/views/front/page/Home')
      }, {
        path: 'display',
        component: () => import("@/views/front/page/DisplayPlant")
      }, {
        path: 'userInfo',
        component: () => import("@/views/front/page/DisplayUser")
      }
    ]
  }, {
    path: '/front/login',
    component: () => import('@/views/front/page/login/Login')
  }, {
    path: '/front/register',
    component: () => import('@/views/front/page/login/Register')
  },
  {
    path: '/backend',
    component: Backend,
    redirect: '/backend/admins',
    children: [
      {
        path: 'admins',
        component: () => import('@/views/backend/page/AdminView')
      }, {
        path: 'users',
        component: () => import('@/views/backend/page/UserView')
      }, {
        path: 'plants',
        component: () => import('@/views/backend/page/PlantView')
      }, {
        path: 'types',
        component: () => import('@/views/backend/page/TypeView')
      }, {
        path: 'messages',
        component: () => import('@/views/backend/page/MsgView')
      }, {
        path: 'tips',
        component: () => import('@/views/backend/page/TipView')
      }, {
        path: 'lunches',
        component: () => import('@/views/backend/page/LunchView')
      }, {
        path: 'growth',
        component: () => import('@/views/backend/page/GrowthView')
      },
    ]
  }, {
    path: '/backend/login',
    component: () => import('@/views/backend/page/login/Login')
  },
  {
    path: '/backend/register',
    component: () => import('@/views/backend/page/login/Register')
  }
  ,
  {
    path: '/404',
    component: () => import('@/views/NotFound.vue')
  },
  {
    path: '/undone',
    component: () => import('@/views/NotFinished.vue')
  }
  , {
    path: '*',
    redirect: '/404'
  }
]

const router = new VueRouter({
  routes: routes,
  mode: 'history'
})

export default router
